from django.db import models

MAXSEAT = 500
DESEAT = ""
for i in range(100):
    DESEAT += "1"



class FlightInfo(models.Model):
    id = models.AutoField(primary_key=True)
    flightName = models.CharField(max_length=100)
    startPos = models.CharField(max_length=100)
    endPos = models.CharField(max_length=100)
    startTime = models.DateTimeField(max_length=100)
    endTime = models.DateTimeField(max_length=100)
    isDelay = models.BooleanField(default=False)
    leftSeat = models.IntegerField(default=MAXSEAT)
    maxSeat = models.IntegerField(default=MAXSEAT)
    seatInfo = models.CharField(max_length=MAXSEAT, default=DESEAT)
    price = models.DecimalField(decimal_places=2, max_digits=10)
    startAir = models.CharField(max_length=100)
    endAir = models.CharField(max_length=100)
    state = models.IntegerField(max_length=2, default=1)
    dseatTime = models.DateTimeField(max_length=100)
    # dterminalTime = models.DateTimeField(max_length=100)
    dboardingTime = models.DateTimeField(max_length=100, null=True)
    # terminal = models.CharField(max_length=100, default="尚未分配")
    # boardingGate = models.CharField(max_length=100, default="尚未分配")


class TicketInfo(models.Model):
    id = models.AutoField(primary_key=True)
    flightName = models.CharField(max_length=100)
    seatNo = models.CharField(max_length=100)
    # terminal = models.CharField(max_length=100)
    # boardingGate = models.CharField(max_length=100)
    passengerId = models.CharField(max_length=100)
    userId = models.CharField(max_length=100)
    price = models.DecimalField(decimal_places=2, max_digits=10)
    flightId = models.IntegerField(max_length=10, null=True)
    passengerName = models.CharField(max_length=100, null=True)


class AirportInfo(models.Model):
    name = models.CharField(max_length=100, primary_key=True)
    location = models.CharField(max_length=100)

# Create your models here.
